package com.bjtu.ptsite.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.bjtu.ptsite.service.UserService;

import lombok.val;

/**
 *
 * @author Zehao Wang, Junjie Zhang, Yutao Wei
 *
 */
@Component
public class UserTask {
    @Autowired
    private UserService userService;

    @Scheduled(cron = "0 0 * * * ?")
    public void checkForUpgrades() {
        userService.upgradeQualifiedUsers();
    }

    @Scheduled(cron = "0 0 * * * ?")
    public void countSharingRate(){
        userService.countSharingRate();
    }

    @Scheduled(cron = "0 0 0 * * ?")
    public void resetDailyAward(){
        userService.resetDailyAward();
    }

    @Scheduled(cron = "0 0 2 * * ?")
    public void dailyAssess(){
        userService.dailyAssess();
    }
}
